package com.polito.mad.bikeponyapp.persistence;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

public class DeliveriesRepository extends Repository<DeliveryItem, DeliveryItemDAO>
{
	public DeliveriesRepository(Context ctx)throws Exception {
		super(ctx, new DeliveryItemDAO(ctx));
		//sessionCachedItems= new ArrayList<DeliveryItem>();
	}
	
	public List<Long> getItemsClone()
	{
		return itemsClone;
	}
	public void setItemsClone(List<Long>itemsClone)
	{
		if(itemsClone==null)
			this.itemsClone = null;
		else
			this.itemsClone = new ArrayList<Long>(itemsClone);
	}
	public void flushItemsClone()
	{
		this.itemsClone = null;
	}
	
	public List<DeliveryItem> getSessionCachedItems() {
		return sessionCachedItems;
	}
	public void setSessionCachedItems(List<DeliveryItem> sessionCachedItems) {
		
		if(sessionCachedItems == null)
			this.sessionCachedItems=null;
		else
			this.sessionCachedItems = new ArrayList<DeliveryItem>(sessionCachedItems);
	}
	public void flushCachedObjects()
	{
		this.itemsClone= null;
		this.sessionCachedItems = null;
	}
	private List<DeliveryItem>sessionCachedItems;
	private List<Long> itemsClone;
	
	
	
	
	
}
